
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>1MyBatis执行流程 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>1MyBatis执行流程 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在MyBatis中，执行SQL操作的核心对象是什么？它是由哪个工厂对象通过什么方法创建的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">执行SQL操作的核心对象是 `SqlSession`。它由 `SqlSessionFactory` 创建，通过 `openSession()` 方法获取。</div>
          </div>
          <div class="card-source">来源: 1. `SqlSession` 初始化与获取</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">当调用 `SqlSession` 的 `selectList()` 方法时，它内部会委托给哪个核心接口来执行具体的SQL查询？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`selectList()` 方法会调用 `Executor` 接口的 `query()` 方法。`Executor` 接口是负责执行具体SQL操作的核心。</div>
          </div>
          <div class="card-source">来源: 2. `SqlSession` 中的 `select` 方法</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">组件</div>
          <div class="card-question">MyBatis中的执行器 `Executor` 有哪些常见的实现？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">组件</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">常见的 `Executor` 实现有 `SimpleExecutor`, `ReuseExecutor` 和 `BatchExecutor`。</div>
          </div>
          <div class="card-source">来源: 3. `Executor` 接口与 `query()` 方法</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">组件</div>
          <div class="card-question">`StatementHandler` 在MyBatis中的主要职责是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">组件</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`StatementHandler` 负责SQL的准备工作，例如创建 `PreparedStatement` 对象、执行SQL语句的预编译以及为查询设置参数。</div>
          </div>
          <div class="card-source">来源: 4. `StatementHandler` 的工作原理</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">组件</div>
          <div class="card-question">在MyBatis中，哪个组件专门负责将Java对象中的参数绑定到SQL语句中？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">组件</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`ParameterHandler` 是用来处理SQL语句参数的组件，它负责将Java对象中的参数绑定到SQL语句中。</div>
          </div>
          <div class="card-source">来源: 5. `ParameterHandler` 的作用</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">组件</div>
          <div class="card-question">`ResultSetHandler` 的核心功能是什么？它是如何处理查询结果的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">组件</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`ResultSetHandler` 负责处理SQL执行后的结果集，它会将 `ResultSet` 中的每一行数据提取出来，并映射为目标Java对象。</div>
          </div>
          <div class="card-source">来源: 6. `ResultSetHandler` 的工作原理</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">MyBatis中的 `MappedStatement` 对象封装了哪些关键信息？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`MappedStatement` 对象用于封装SQL语句和映射信息，它包含了执行SQL语句的详细信息，如SQL语句本身、查询参数类型和结果类型等。</div>
          </div>
          <div class="card-source">来源: 7. `MappedStatement` 的配置与 SQL 映射</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">MyBatis是如何管理事务的？哪个接口为此提供了支持？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">MyBatis使用 `Transaction` 接口来管理事务。该接口负责开启、提交和回滚事务，其具体实现由数据库连接来控制。</div>
          </div>
          <div class="card-source">来源: 8. 事务管理与 `Transaction` 接口</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">MyBatis如何支持动态SQL的生成？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">MyBatis支持通过 `<if>`, `<choose>` 等标签来动态生成SQL语句。在执行时，`SqlSession` 会根据 `MappedStatement` 的配置动态构建SQL。</div>
          </div>
          <div class="card-source">来源: 9. 自动生成 SQL 和参数绑定的流程</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
